/**
 * chivox API英文评分反馈结果中音素和国际音标的映射表。
 *
 * @module ChiVoxSDK/lib
 * @author Don Li <kai.li@chivox.com>
 * @licence
 * Copyright (c) 2017 - 2020 ChiVox Inc. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

const __map = {
    "ih": "ɪ",
    "ax": "ə",
    "oh": "ɒ",
    "uh": "ʊ",
    "ah": "ʌ",
    "eh": "e",
    "ae": "æ",
    "iy": "i:",
    "er": "ɜ:",
    "axr": "ɚ",
    "ao": "ɔ:",
    "uw": "u:",
    "aa": "ɑ:",
    "ey": "eɪ",
    "ay": "aɪ",
    "oy": "ɔɪ",
    "aw": "aʊ",
    "ow": "әʊ",
    "ia": "ɪə",
    "ea": "ɛә",
    "ua": "ʊə",
    "p": "p",
    "b": "b",
    "t": "t",
    "d": "d",
    "k": "k",
    "g": "g",
    "l": "l",
    "r": "r",
    "m": "m",
    "n": "n",
    "ng": "ŋ",
    "hh": "h",
    "s": "s",
    "z": "z",
    "th": "θ",
    "dh": "ð",
    "f": "f",
    "v": "v",
    "w": "w",
    "y": "j",
    "sh": "ʃ",
    "zh": "ʒ",
    "ch": "tʃ",
    "jh": "dʒ",
};

/**
 * EnScoreMap类。
 */
class EnScoreMap {
    /**
     * 根据映射字符获得国际音标。如果没找到，则返回原字符串。
     * @param {string} key
     * @return {string}
     */
    static get(key) {
        if (typeof __map[key] === "string") {
            return __map[key];
        }

        return key;
    }
};

export default EnScoreMap
